--[[
FilePath: \Lua\View\UIActivityCenter\UIActivityListTask.lua
周期兑换- 活跃任务 
--]]

require 'View/UIBase/UIBase'

UIActivityListTask = UIBase.New(PanelResNames.UIActivityListTask)
local _M = UIActivityListTask

_M.hasInit = false
_M.activeId = nil
_M.ContentItems = {}
_M.playEffect = false
_M.selectIndex = 0
_M.scrollIndex = -1
_M.preScrollIndex = -1;
_M.curScrollIndex = 0
_M.hasEnoughNum = false
_M.RoleLihui = nil
_M.timerId = nil
_M.btnTimerId = nil

function _M.Init(func, id)
    _M.activeId = id
    UIBase.Init(_M, func)
end

function _M:OnCreate()
    if not _M.hasInit then
        self:RegisterOnClick(self:GetChild("back"), self.OnBack)
        self.btnHelp = self:GetChild("help")
        self.banner = self:GetChild("bg01")
        self.title = self:GetChild("n2"):GetChild("title")
        self.txtTips = self:GetChild("title")
        self.btnDay = self:GetChild("btnDay")
        self.dayController = self.btnDay:GetChild("UIRedDots"):GetController("c1");
        self.btnTotal = self:GetChild("btnTotal")
        self.totalController = self.btnTotal:GetChild("UIRedDots"):GetController("c1");
        self.btnConfirm = self:GetChild("ConfirmBtn")
        self.confirmController = self:GetController("Button");
        self.itemList = self:GetChild("dynamicList")
        self.toggleController = self:GetController("toggleController")
        self.bgTitle = self:GetChild("bgtitle")
        self.bgTitleTips = self:GetChild("bgtitletips")
        self.heartGroup = self:GetChild("heartGroup");
        self.number = self:GetChild("number");
        self.btnLeft = self:GetChild("left");
        self.btnRight = self:GetChild("right");
        self.lihui = self:GetChild("lihui");
        self.bgProtect = self:GetChild("bgprotect");
        self.itemIcon = self:GetChild("ItemIcon");
        self.tipTime = self:GetChild("tipTime");

        if self.activeId ~= nil then
            _M.activityTabConfig = G.dataTable["t_activitylist"][tostring(self.activeId)];
            self.activeConfigModel = G.dataTable[tostring(_M.activityTabConfig.f_ModelName)][tostring(self.activeId)];
        end

        self.itemList.itemRenderer = self.RefreshItem;
        self.heartGroup.itemRenderer = self.RefreshLotteryItem;
        _M.selectIndex = 7;
        self:addEvent()
        self:InitView()
        self:InitLottery()
        _M.hasInit = true
    end
end

function _M:addEvent()
    self.btnHelp.onClick:Add(self.HelpTip)
    self.btnDay.onClick:Add(self.ChangeDay)
    self.btnTotal.onClick:Add(self.ChangeTotal)
    self.btnLeft.onClick:Add(self.OnScrollToLast)
    self.btnRight.onClick:Add(self.OnScrollToNext)
    self.btnConfirm.onClick:Add(self.ConfirmReward)
    self.heartGroup.scrollPane.onScrollEnd:Add(self.heartGroupScroll);
    self:RegisterEvent(Config.EventType.Fresh_Active,self.RefreshActive);
end

function _M:removeEvent()
    self.btnHelp.onClick:Remove(self.HelpTip)
    self.btnDay.onClick:Remove(self.ChangeDay)
    self.btnTotal.onClick:Remove(self.ChangeTotal)
    self.btnLeft.onClick:Remove(self.OnScrollToLast)
    self.btnRight.onClick:Remove(self.OnScrollToNext)
    self.btnConfirm.onClick:Remove(self.ConfirmReward)
    self.heartGroup.scrollPane.onScrollEnd:Remove(self.heartGroupScroll);
end

function _M.HelpTip()
    if _M.activeConfigModel ~= nil and _M.activeConfigModel.f_ExplainTitle ~= nil and _M.activeConfigModel.f_ExplainText ~= nil then
        logicMgr.UIShowManager.ShowCommonTips(tostring(_M.activeConfigModel.f_ExplainTitle), tostring(_M.activeConfigModel.f_ExplainText), "FunctionStory704");
    end
end

function _M.ChangeDay()
    if _M.selectIndex == 7 then
        return;
    end
    _M.selectIndex = 7;
    _M.playEffect = true;
    _M:refreshTask();
end

function _M.ChangeTotal()
    if _M.selectIndex == 8 then
        return;
    end
    _M.selectIndex = 8;
    _M.playEffect = true;
    _M:refreshTask();
end

function _M.OnScrollToNext()
    if _M.scrollIndex >= #_M.lotteryReward then
        return;
    end
    _M.heartGroup.scrollPane:ScrollRight(1, true);
end

function _M.OnScrollToLast()
    if _M.scrollIndex <= 0 then
        return;
    end
    _M.heartGroup.scrollPane:ScrollLeft(1, true);
end

_M.isLottery = false;
function _M.ConfirmReward()
    if _M.isLottery then
        return;
    end

    if _M.scrollIndex < _M.curScrollIndex or _M.hasGetAllReward then
        UISysTips.AddMsg(getLanguage("ActivityListTaohuaTips18"))
        return;
    end
    if _M.scrollIndex > _M.curScrollIndex then
        UISysTips.AddMsg(getLanguage("ActivityListTaohuaTips19"))
        return;
    end

    if not _M.hasEnoughNum then
        UISysTips.AddMsg(string.format(getLanguage("Character_Tips19"),getLanguage(_M.costItemName)));
        return;
    end

    _M.isLottery = true;
    _M.bgProtect.visible = true;
    ActivityHandler.sendReqActivityLotteryRewardMessage({_M.activeId});
    if _M.btnTimerId ~= nil then
        utimer.remove(_M.btnTimerId);
        _M.btnTimerId = nil;
    end
    _M.btnTimerId = utimer.timeCall(function()
        utimer.remove(_M.btnTimerId);
        _M.btnTimerId = nil;
        _M.bgProtect.visible = false;
    end, 2000, 1);
end

function _M.heartGroupScroll()
    local localIndex = tonumber(_M.heartGroup.scrollPane.currentPageX);
    if localIndex == _M.scrollIndex then
        return;
    end
    _M.scrollIndex = localIndex;

    _M:refreshSwitch();
--[[
    local strKey;
    if _M.lotteryTitle ~= nil then
        _M.bgTitleTips.text = getLanguage(tostring(_M.lotteryTitle[_M.scrollIndex + 1]));
    end
    if _M.scrollIndex > _M.curScrollIndex then
        _M.confirmController.selectedIndex = 0;
        strKey = "ActivityListTaohuaTips20";
    elseif _M.scrollIndex == _M.curScrollIndex then
        if _M.serverData ~= nil and _M.serverData.param ~= nil and _M.serverData.param.poolRemainIndex ~= nil and #_M.serverData.param.poolRemainIndex > 0 then
            _M.confirmController.selectedIndex = 1;
            strKey = "ActivityListTaohuaTips9";
        else
            _M.confirmController.selectedIndex = 2;
            strKey = "ActivityListTaohuaTips21";
        end
    else
        _M.confirmController.selectedIndex = 2;
        strKey = "ActivityListTaohuaTips21";
    end
    _M.btnConfirm.text = getLanguage(strKey);
    --]]
end

function _M:refreshSwitch()
    local maxCount = #self.lotteryReward - 1;
    if self.scrollIndex >= maxCount then
        self.btnRight.visible = false;
    else
        self.btnRight.visible = true;
    end
    if self.scrollIndex <= 0 then
        self.btnLeft.visible = false;
    else
        self.btnLeft.visible = true;
    end

    self.hasGetAllReward = false;
    local strKey;
    if _M.lotteryTitle ~= nil then
        _M.bgTitleTips.text = getLanguage(tostring(_M.lotteryTitle[_M.scrollIndex + 1]));
    end
    if _M.scrollIndex > _M.curScrollIndex then
        _M.confirmController.selectedIndex = 0;
        strKey = "ActivityListTaohuaTips20";
    elseif _M.scrollIndex == _M.curScrollIndex then
        if _M.serverData ~= nil and _M.serverData.param ~= nil and _M.serverData.param.poolRemainIndex ~= nil and #_M.serverData.param.poolRemainIndex > 0 then
            _M.confirmController.selectedIndex = 1;
            strKey = "ActivityListTaohuaTips9";
        else
            _M.confirmController.selectedIndex = 2;
            strKey = "ActivityListTaohuaTips21";
            self.hasGetAllReward = true;
        end
    else
        _M.confirmController.selectedIndex = 2;
        strKey = "ActivityListTaohuaTips21";
    end
    _M.btnConfirm.text = getLanguage(strKey);
end

function _M:initData()
    self.ContentItems = {}
    self.playEffect = false
    self.selectIndex = 0
    self.scrollIndex = -1
    self.preScrollIndex = -1;
    self.curScrollIndex = 0
    self.hasEnoughNum = false
end

-- 显示
function _M:OnEnable()
    self.playEffect = true;
    self:initData();
    self:Refresh(true);
    self:refreshLottery(false, 0);
end

function _M:InitView()
    if self.activeConfigModel ~= nil then
        if self.activeConfigModel.f_BgPic ~= nil and self.activeConfigModel.f_BgPic ~= "" then
            self.banner.url = self.activeConfigModel.f_BgPic;
        end
        self.title.text = getLanguage(self.activeConfigModel.f_ActivityName);
        self.btnConfirm.text = getLanguage("ActivityListTaohuaTips9");
        self.btnDay.text = getLanguage("ActivityListTaohuaTips11");
        self.btnTotal.text = getLanguage("ActivityListTaohuaTips12");
        self.txtTips.text = getLanguage("ActivityListTaohuaTips10");
        if self.activeConfigModel.f_Hero ~= nil then
            local imageName = logicMgr.HeroManager.GetHeroDrawingPath(self.activeConfigModel.f_Hero)
            if self.drawWrapper == nil then
                self.drawWrapper = GoWrapper.New()
            end
            resMgr:LoadModelPrefab(imageName, function(go)
                if(self.RoleLihui~=nil)then
                    destroyImmediate(self.RoleLihui);
                end
                self.RoleLihui = newObject(go);
                self.RoleLihui.name = imageName;
                Util.AddAction(self.RoleLihui,"idle1",true,0.5);
                self.RoleLihui:AddComponent(TCanvas);
                self.drawWrapper:SetWrapTarget(self.RoleLihui,false);
                Util.Lua_SetLocalPositionXYZ(self.RoleLihui.transform,0,0,0)
                Util.Lua_SetLocalScaleXYZ(self.RoleLihui.transform,1.1,1.1,1.1)
                self.lihui:SetNativeObject(self.drawWrapper);
            end)
        end
    end
end

function _M:InitLottery()
    if self.activeConfigModel == nil then
        return ;
    end

    local childModelName = decodeJsonStrToTabel(self.activeConfigModel.f_ModelName);
    local config = G.dataTable[tostring(childModelName[1])][tostring(self.activeId)];
    self.lotteryReward = decodeJsonStrToTabel(config.f_LotteryReward);
    self.lotteryTitle = decodeJsonStrToTabel(config.f_LotteryTittle);
    self.lotteryTab = {};
    self.heartGroup.numItems = #self.lotteryReward;
    self.confirmController.selectedIndex = 1;

    local costItem = decodeJsonStrToTabel(config.f_LotteryCost);
    self.itemIcon.icon = EnumConst.AtlasPath.ItemAtlas .. G.dataTable["t_item"][tostring(costItem[1][1])].f_Icon;
end

function _M:RefreshActive()
    self.playEffect = false;
    self:Refresh(false);
end

_M.serverDataTab = nil;
function _M:Refresh(refreshSelect)
    if self.activeId == nil or not _M.hasInit then
        self:OnBack();
    else
        self.tableData, self.serverData = logicMgr.ActiveManager.getActiveData(self.activeId);
        if self.serverData == nil then
            self:OnBack();
            return;
        end
    end
    self.serverDataTab = nil;
    self.curScrollIndex = tonumber(self.serverData.param.poolIndex);
    if self.scrollIndex < 0 then
        self.scrollIndex = self.curScrollIndex;
    end
    if self.preScrollIndex < 0 then
        self.preScrollIndex = self.curScrollIndex;
    end
    self:RefreshTabRed(refreshSelect);
    self:refreshTask();
    self:refreshLotteryCost();

    local time = HelperFunc.GetServerTime();
    self.endCountDown = self.serverData.endTime - time;
    self:updateActiveCountDown();
    self:TimeCall(self.updateActiveCountDown, 1000, -1);
end

function _M:updateActiveCountDown()
    if self.endCountDown == nil then
        return;
    end
    if self.endCountDown <= 0 then
        self.tipTime.text = getLanguage("Sys_ActivityEnd");
        self:RemoveTimeCall(self.updateActiveCountDown)
    else
        self.tipTime.text = string.format(getLanguage("Sys_ActivityTimeLeft"), HelperFunc.GetSurpTimeStr(self.endCountDown));
    end
    self.endCountDown = self.endCountDown - 1;
end

function _M:RefreshTabRed(refreshSelect)
    local childModelName = decodeJsonStrToTabel(self.activeConfigModel.f_ModelName);
    local config = G.dataTable[tostring(childModelName[2])];
    local serverTaskData = self.serverData.param.taskMap;
    local dayRed = false;
    local totalRed = false;
    for k, v in pairs(config) do
        if tonumber(v.f_ActivityId) == tonumber(self.activeId) then
            local taskData = serverTaskData[tostring(v.f_ActTaskId)];
            if taskData ~= nil and not taskData.rewarded then
                if taskData.process >= v.f_Progress then
                    if tonumber(v.f_FunctionType) == 7 then
                        dayRed = true;
                    else
                        totalRed = true;
                    end
                end
            end
        end
    end
    if dayRed then
        self.dayController.selectedIndex = 2;
    else
        self.dayController.selectedIndex = 0;
    end
    if totalRed then
        self.totalController.selectedIndex = 2;
    else
        self.totalController.selectedIndex = 0;
    end
    if refreshSelect then
        self.selectIndex = 7;
        self.toggleController.selectedIndex = 0;
        if not dayRed and totalRed then
            self.selectIndex = 8;
            self.toggleController.selectedIndex = 1;
        end
    end
end

_M.itemConfig = nil;
function _M:refreshTask()
    self.itemConfig = nil;
    self.itemConfig = {};
    local childModelName = decodeJsonStrToTabel(self.activeConfigModel.f_ModelName);
    local config = G.dataTable[tostring(childModelName[2])];
    for k, v in pairs(config) do
        if tonumber(v.f_ActivityId) == tonumber(self.activeId) and self.selectIndex == tonumber(v.f_FunctionType) then
            table.insert(self.itemConfig, v)
        end
    end

    table.sort(self.itemConfig, function(a, b)
        local numA, stateA = self:GetServerData(a);
        local numB, stateB = self:GetServerData(b);
        if stateA > stateB then
            return true
        end ;
        if stateA < stateB then
            return false
        end ;
        return a.f_ActTaskId < b.f_ActTaskId;
    end)

    local ta, state = nil,nil
    for k,v in pairs(self.itemConfig) do
        ta, state = self:GetServerData(v)
        if state == 1 then
            ActiveManager.Track_OnTaoHuaFinish(v.f_ActTaskId)
        end
    end

    self.itemList.numItems = #self.itemConfig;
    self.itemList:ScrollToView(0);
    if self.playEffect then
        self.playEffect = false;
        HelperFunc.ListTranstionPlay(self.itemList)
    end
end

function _M:refreshLottery(showReward, index)
    if self.activeConfigModel == nil then
        return;
    end
    if showReward then
        local tabData = self.lotteryTab[_M.preScrollIndex + 1];
        local tabDataIndex = tonumber(index) + 1;
        local effect = tabData[tabDataIndex].effect;
        local idleAniTime = effect.spineAnimation.state.Data.SkeletonData:FindAnimation("idle2").Duration;
        if _M.timerId ~= nil then
            utimer.remove(_M.timerId)
        end
        _M.timerId = utimer.timeCall(function()
            utimer.remove(_M.timerId);
            _M.timerId = nil;
            if _M.btnTimerId ~= nil then
                utimer.remove(_M.btnTimerId);
                _M.btnTimerId = nil;
            end
            local reward = self.lotteryReward[self.preScrollIndex + 1][index + 1];
            local rewards = {};
            if reward ~= nil then
                local itemData = logicMgr.CostManager.getItemOrEquipDataByIdAndNum(reward[1], reward[2]);
                if itemData ~= nil then
                    table.insert(rewards, itemData);
                end
            end
            if #rewards > 0 then
                showUI(PanelNames.UICommonItemGet, nil, nil, 3, rewards, self.closeItemGet);
            else
                self.closeItemGet();
            end
            _M:SetLotteryTabSelected(tabData, tabDataIndex, 1);
            _M.isLottery = false;
            _M.bgProtect.visible = false;
        end, idleAniTime * 500, 1);
        effect.spineAnimation.state:SetAnimation(0, "idle2", false);
    else
        self.closeItemGet();
        local scrollIndex = self.curScrollIndex + 1;
        local tabNum = #self.lotteryTab;
        for i = 1, scrollIndex do
            if i <= tabNum then
                local tabData = self.lotteryTab[i];
                if tabData ~= nil then
                    for j = 1, #tabData do
                        local controllerIndex = j;
                        _M:SetLotteryTabSelected(tabData, controllerIndex, 1);
                    end
                    if i == scrollIndex then
                        local poolRemainData = self.serverData.param.poolRemainIndex;
                        if poolRemainData ~= nil then
                            for k,v in pairs(poolRemainData) do
                                local controllerIndex = tonumber(v) + 1;
                                _M:SetLotteryTabSelected(tabData, controllerIndex, 0);
                            end
                        end
                    end
                end
            end
        end
    end
end

function _M:SetLotteryTabSelected(tabData, index, state)
    local tabIndex = tonumber(index);
    if tabData ~= nil and tabIndex <= #tabData then
        local localTabState = tonumber(state);
        tabData[tabIndex].state.selectedIndex = localTabState;
        tabData[tabIndex].heart.selectedIndex = localTabState;
    end
end

function _M.closeItemGet()
    --可能有刷新动画
    _M.bgTitleTips.text = getLanguage(tostring(_M.lotteryTitle[_M.curScrollIndex + 1]));
    _M.heartGroup:ScrollToView(_M.curScrollIndex);
    _M.preScrollIndex = _M.curScrollIndex;
    _M.scrollIndex = _M.curScrollIndex;
    _M:refreshSwitch();
    --[[
    local maxCount = #_M.lotteryReward - 1;
    if _M.curScrollIndex >= maxCount then
        if _M.serverData ~= nil and _M.serverData.param ~= nil and _M.serverData.param.poolRemainIndex ~= nil and #_M.serverData.param.poolRemainIndex > 0 then
            _M.confirmController.selectedIndex = 1;
        else
            _M.confirmController.selectedIndex = 2;
            _M.btnConfirm.text = getLanguage("ActivityListTaohuaTips21");
        end
    end
    --]]
end

function _M:refreshLotteryCost()
    local childModelName = decodeJsonStrToTabel(self.activeConfigModel.f_ModelName);
    local config = G.dataTable[tostring(childModelName[1])][tostring(self.activeId)];

    local costItem = decodeJsonStrToTabel(config.f_LotteryCost);
    local haveNum = logicMgr.ItemManager.getBagNumByTableID(costItem[1][1]);
    local costNum = tonumber(costItem[1][2]);
    self.hasEnoughNum = false;
    self.costItemName = G.dataTable["t_item"][tostring(costItem[1][1])].f_ItemName;
    if haveNum >= costNum then
        self.hasEnoughNum = true;
        self.number.text = "[color=#A0C776]"..haveNum.."[/color]/"..costNum;
    else
        self.number.text = "[color=#FF2A4D]"..haveNum.."[/color]/"..costNum;
    end
end

function _M.RefreshLotteryItem(index, itemObj)
    local tabData = {};
    for i = 1, 6 do
        local btn = itemObj:GetChild("Button"..i);
        local item = btn:GetChild("Button");
        logicMgr.CostManager.RefreshItem(item, _M.lotteryReward[index + 1][i])
        local data = {};
        data.state = btn:GetController("state");
        local heart = itemObj:GetChild("Heart"..i);
        data.heart = heart:GetController("state");
        data.effect = heart:GetChild("effect_taohua_sjdt");
        --local aniObj = heart.displayObject.gameObject.transform:Find("GLoader3D/GoWrapper/effect_taohua_sjdt_SkeletonData")
        --if aniObj then
           -- Util.PlayAction(aniObj.gameObject, "idle2", true);
        --end
        --heart:GetChild("effect_taohua_sjdt").spineAnimation.state:SetAnimation(0, "idle2", true);
        --local idleAniTime = heart:GetChild("effect_taohua_sjdt").spineAnimation.state.Data.SkeletonData:FindAnimation("idle2").Duration;
        table.insert(tabData, data);
    end
    table.insert(_M.lotteryTab, tabData);
end

function _M:GetServerData(config)
    if self.serverData == nil or self.serverData.param == nil or self.serverData.param.taskMap == nil then
        return 0, -1;
    end

    if not logicMgr.FuncOpenManager.isOpen(config.f_Switchover) then
        return 0, -2;
    end

    local taskData = self.serverData.param.taskMap[tostring(config.f_ActTaskId)];
    if taskData == nil then
        return 0, 0;
    elseif taskData.rewarded then
        return taskData.process, -1;
    elseif tonumber(taskData.process) >= tonumber(config.f_Progress) then
        return taskData.process, 1;
    else
        return taskData.process, 0;
    end
end

function _M.RefreshItem(index, itemObj)
    _M:CreateItem(index, itemObj)
    local config = _M.itemConfig[index + 1];
    local num, state = _M:GetServerData(config);
    _M.ContentItems[index]:OnShow(config, num, state)
end

function _M:CreateItem(index,itemObj)
    if self.ContentItems[index] then
        return
    end
    local item = self.UIActivityListTaskItem.New()
    self.ContentItems[index] = item
    item:OnCreate(itemObj,self)
end

function _M.showReward(index)
    _M:refreshLottery(true, index);
end

-- 隐藏
function _M:OnDisable()

end

-- 卸载
function _M:OnDestroy()
    self:removeEvent();
    if self.RoleLihui~=nil then
        destroy(self.RoleLihui)
        self.RoleLihui = nil
    end
    if self.timerId ~= nil then
        utimer.remove(self.timerId)
        self.timerId = nil;
    end
    if _M.btnTimerId ~= nil then
        utimer.remove(_M.btnTimerId);
        _M.btnTimerId = nil;
    end
    if self.ContentItems then
        for key, value in pairs(self.ContentItems) do
            value:OnDestroy()
        end
        self.ContentItems = {}
    end
    self.isLottery = false;
end

-- item类
_M.UIActivityListTaskItem = Class("UIActivityListTaskItem",UIComponentInterface)
local _M_T = _M.UIActivityListTaskItem
function _M_T:OnCreate(obj,parent)
    self.taskId = 0
    self.parent = parent
    self.fguiObj = obj
    self.isGet = false
    
    self.title = obj:GetChild("titleLab");
    self.process = obj:GetChild("processLab");
    self.btnGo = obj:GetChild("noRewardGo");
    self.btnGet = obj:GetChild("rewardGo");
    self.rewardList = obj:GetChild("list");
    self.status = obj:GetController("status");

    self.parent:RegisterOnClick(self.btnGo,self.ClickGoto,self)
    self.parent:RegisterOnClick(self.btnGet,self.ClickReward,self)
end
function _M_T:OnShow(itemConfig, progress, hasGet)
    self.config = itemConfig;
    self.progress = tonumber(progress);
    self.hasGet = tonumber(hasGet);
    self:Refresh()
end

function _M_T:Refresh()
    logicMgr.CostManager.RefreshItemList(self.rewardList, decodeJsonStrToTabel(self.config.f_Award), nil, {isShowBigNum = true});
    self.title.text = getLanguage(self.config.f_ActTaskDesc);
    self.process.text = self.progress.."/"..self.config.f_Progress;

    if self.hasGet == -1 then
        self.status.selectedIndex = 2;
    elseif self.hasGet == -2 then
        self.status.selectedIndex = 3;
    else
        self.status.selectedIndex = self.hasGet;
    end
end

function _M_T:OnHide()

end
function _M_T:OnDestroy()

end

function _M_T:ClickGoto()
    closeUI(self.parent._panelName)
    closeUI(PanelNames.UIActivityList)
    closeUI(PanelNames.UIActivity)
    showUI(PanelNames.UIHeadMenu);
    logicMgr.FuncOpenManager.jump(self.config.f_Switchover)
end

function _M_T:ClickReward()
    if self.isGet then
        return;
    end

    self.isGet = true;

    ActivityHandler.sendReqActivityDrawRewardMessage({_M.activeId, tonumber(self.config.f_ActTaskId)});
    ActiveManager.Track_OnTaoHuaReward(self.config.f_ActTaskId)

    self:TimeCall(self.TimeEnd, 100);
end

function _M_T:TimeEnd()
    self:RemoveTimeCall(self.TimeEnd)
    self.isGet = false;
end

return _M;